import type { PageParam, PageResult } from '#/api/base';

import { requestClient } from '#/api/request';

export namespace CompanyApi {
  /** 岗位信息 */
  export interface Company {
    id?: number;
    name: string;
    handler: number;
    handlerName: string;
    createTime: string;
    updateTime: string;
  }
}

/** 查询公司列表 */
export function getCompanyList(params: PageParam) {
  return requestClient.get<PageResult<CompanyApi.Company>>('/company/list', {
    params,
  });
}

/** 查询公司详情 */
export function getCompany(id: number) {
  return requestClient.get<CompanyApi.Company>(`/company/info?id=${id}`);
}

/** 新增公司 */
export function createCompany(data: CompanyApi.Company) {
  return requestClient.post('/company/create', data);
}

/** 修改公司 */
export function updateCompany(data: CompanyApi.Company) {
  return requestClient.put('/company/update', data);
}

/** 删除公司 */
export function deleteCompany(id: number) {
  return requestClient.delete(`/company/delete?id=${id}`);
}
